using System;
using System.Collections.Generic;
using System.Text;

namespace NetSpider.Retrieval
{
    /// <summary>
    /// URI helper class.
    /// </summary>
    public static class UriHelper
    {
        /// <summary>
        /// Takes a complete URI as a parameter and returns only the DNS portion of the URI.
        /// <example>Takes the URI http://www.some-site.com/index.html and returns 'www.some-site.com'.</example>
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <returns>DNS portion of the URI.</returns>
        public static string GetDnsName(string uri)
        {
            return "";
            // throw exception if URI is relative
        }

        public static string GetUriSchema(string uri)
        {
            //TODO check with regex instead to give proper results
            uri = uri.ToLower(); // method scope only
            if (uri.StartsWith("https"))
            {
                return "https";
            }
            else if (uri.StartsWith("http"))
            {
                return "http";
            }
            else if (uri.StartsWith("file"))
            {
                return "file";
            }

            return "";
        }
    }
}
